package cn.com.api.mapper;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import cn.com.api.entity.ApiJuan;
import cn.com.util.*;

public interface ApiJuanMapper {

	public boolean insert(ApiJuan apiJuan);

	// 更新
	public boolean updateJuan(ApiJuan apiJuan);

	public List<Map<String, String>> select();

	public List<Map<String, String>> selectByModListPage(@Param("map") Map<String, Object> map,
			@Param("page") PageInfo pageInfo);

	public List<Map<String, String>> selectByUid(@Param("uid") String uid);

	public List<Map<String, String>> getJuanListByUserid(@Param("uid") String uid);

	public List<Map<String, String>> getJuanByShopId(@Param("shopid") String shopid);

	public boolean delete(@Param("id") String id);

	public Map<String, Object> selectById(@Param("id") String id);

	public List<Map<String, String>> selectByArea(@Param("cityid") String cityid, @Param("gtype") String gtype);

	// 查询地区可用全城优惠券
	public List<Map<String, String>> selectQuanJuansByArea(@Param("cityid") String cityid);

	// 更新全城优惠劵领取次数
	public boolean updateJuanReceiveCount(@Param("id") String id);

	// 更新全城优惠劵使用次数
	public boolean updateJuanUsedCount(@Param("id") String id, @Param("shopid") String shopid);

	public boolean receiveJuan(@Param("uid") String uid, @Param("juanid") String juanid);

	public boolean receiveQuanJuan(@Param("uid") String uid, @Param("juanid") String juanid,
			@Param("enable") String enable, @Param("qr_code") String qr_code);

	public List<Map<String, String>> payJuan(@Param("money") String money, @Param("citys") String[] citys,
			@Param("shops") String[] shops, @Param("uid") String uid, @Param("types") String[] types);

	/** 根据优惠券id查询优惠券 */
	public ApiJuan selectJuanByCid(@Param("c_id") Integer c_id);

	public List<Map<String, Object>> selectByUserId(@Param("uid") String uid);

	/** 用户中心查看优惠券信息 */
	public List<ApiJuan> searchMemberJuanListPage(@Param("map") Map<String, Object> map, @Param("page") PageInfo page);

	/** 根据优惠券id集合 查询优惠券 */
	public List<ApiJuan> findByCidCollect(@Param("list") String[] list);

	public boolean updateCanReceive(String cid);
}